/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.jcdev.coolrss.model.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author carlos
 */
@Entity
@Table(name = "DESCRIPTION")
@NamedQueries({
    @NamedQuery(name = "Description.findAll", query = "SELECT d FROM Description d"),
    @NamedQuery(name = "Description.findByDescriptionId", query = "SELECT d FROM Description d WHERE d.descriptionId = :descriptionId"),
    @NamedQuery(name = "Description.findByDescriptionType", query = "SELECT d FROM Description d WHERE d.descriptionType = :descriptionType")})
public class Description implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "DESCRIPTION_ID")
    private Integer descriptionId;
    @Column(name = "DESCRIPTION_TYPE")
    private String descriptionType;
    @Lob
    @Column(name = "DESCRIPTION_VALUE")
    private String descriptionValue;
    @JoinColumn(name = "ENTRY_ID", referencedColumnName = "ENTRY_ID")
    @ManyToOne(optional = false)
    private Entry entryId;

    public Description() {
    }

    public Description(Integer descriptionId) {
        this.descriptionId = descriptionId;
    }

    public Integer getDescriptionId() {
        return descriptionId;
    }

    public void setDescriptionId(Integer descriptionId) {
        this.descriptionId = descriptionId;
    }

    public String getDescriptionType() {
        return descriptionType;
    }

    public void setDescriptionType(String descriptionType) {
        this.descriptionType = descriptionType;
    }

    public String getDescriptionValue() {
        return descriptionValue;
    }

    public void setDescriptionValue(String descriptionValue) {
        this.descriptionValue = descriptionValue;
    }

    public Entry getEntryId() {
        return entryId;
    }

    public void setEntryId(Entry entryId) {
        this.entryId = entryId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (descriptionId != null ? descriptionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Description)) {
            return false;
        }
        Description other = (Description) object;
        if ((this.descriptionId == null && other.descriptionId != null) || (this.descriptionId != null && !this.descriptionId.equals(other.descriptionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.jcdev.coolrss.model.entity.Description[descriptionId=" + descriptionId + "]";
    }

}
